#ifndef MESSAGE_H
#define MESSAGE_H

#include <QString>

enum msgType {ADD,REMOVE,HASH,REQUEST_DOC,SEND_DOC};

class message
{
    public:
	message();
	message(msgType newType);
	message(QByteArray);    //parse from bytes
	QByteArray toBytes();  //get the bytes representation of the msg

	//set functions
	void setType(msgType newType) {type = newType;}
	void setRev(int newRev) {rev = newRev;}
	void setPos(int newPos) {pos = newPos;}
	void setLen(int newLen) {len = newLen;}
	void setData(QString newData) {data = newData;}
	void setId(int newId) {id = newId;}

	//get functions
	const msgType getType() {return type;}
	const int getRev() {return rev;}
	const int getPos() {return pos;}
	const int getLen() {return len;}
	const QString getData() {return data;}
	const int getId() {return id;}

    private:
	msgType type;
	int rev;
	int pos;
	int len;
	QString data;
	int id;
};

#endif // MESSAGE_H
